createCode();

function createCode(){
    var code='';
    var Arr=new Array(0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')
    for(var i=0;i<4;i++){
        var index=Math.floor(Math.random()*36);
        code+=Arr[index];
    }
    document.getElementById('checkcode').value=code;
}

function verify(){
    var code=document.getElementById('checkcode').value;
    var inputcode=document.getElementById('proving').value.toLowerCase();
    if(inputcode.length<=0){
        alert('请输入验证码');
        return false
    }else if(inputcode==code){
        alert('成功');
        return true
    }else {
        alert('输入验证码有误');
        createCode();
        return false;
    }
}